/*
 * Lenovo Group
 * Copyright (c) 2015-2016 All Rights Reserved.
 * Project Name: lmrp-android app
 * Create Time: 16-2-16 下午6:32
 */

package com.lenovo.mso2o.rest;

import com.lenovo.framework.entity.Res;
import com.lenovo.mso2o.entity.FeedbackInfoRequest;
import com.lenovo.mso2o.entity.FileRequest;
import com.lenovo.mso2o.entity.H5PageRequest;
import com.lenovo.mso2o.entity.Mark;
import com.lenovo.mso2o.entity.NewVersionRes;
import com.lenovo.mso2o.entity.g.Ad;
import com.lenovo.mso2o.entity.g.SysDict;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;

import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path;
import rx.Observable;

/**
 * Created by hippo on 11/12/15.
 */
public interface OtherAPI {
    @POST("api/other/updateClientId")
    @FormUrlEncoded
    Call<Res> putCid(@Field("userCIdList") String cidJsonArray);

    @POST("api/other/adList")
    Call<Res<ArrayList<Ad>>> adsList();


    @POST("api/other/saveView")
    @FormUrlEncoded
    Call<Res> feedback(@Field("view") String view, @Field("photo") String... photos);

    @POST("api/other/markList")
    @FormUrlEncoded
    Call<Res<Mark>> markList();


    @POST("api/other/sysDict")
    @FormUrlEncoded
    Call<Res<ArrayList<SysDict>>> dict(@Field("dictType") int type);

    @POST("{end}")
    Call<Res<LinkedHashMap<String, String>>> dynamicPost(@Path(value="end", encoded = true) String end, @Body LinkedHashMap<String, String> params);
    @PUT("{end}")
    Call<Res<LinkedHashMap<String, String>>> dynamicPut(@Path(value="end", encoded = true) String end, @Body LinkedHashMap<String, String> params);
    @DELETE("{end}")
    Call<Res<LinkedHashMap<String, String>>> dynamicDelete(@Path(value="end", encoded = true) String end, @Body LinkedHashMap<String, String> params);

    @POST("{end}")
    Observable<Res<Object>> dynamicPostRx(@Path(value="end", encoded = true) String end, @Body H5PageRequest params);
    @POST("{end}")
    Observable<Res<String[]>> dynamicPostRxFile(@Path(value="end", encoded = true) String end, @Body FileRequest params);
    @PUT("{end}")
    Observable<Res<Object>> dynamicPutRx(@Path(value="end", encoded = true) String end, @Body H5PageRequest params);
    @DELETE("{end}")
    Observable<Res<Object>> dynamicDeleteRx(@Path(value="end", encoded = true) String end, @Body H5PageRequest params);

    @POST("{end}")
    Observable<Res<Object>> dynamicPostRx2(@Path(value="end", encoded = true) String end, @Body LinkedHashMap<String, String> params);
    @POST("{end}")
    Observable<Res<String[]>> dynamicPostRxFile2(@Path(value="end", encoded = true) String end, @Body LinkedHashMap<String, String> params);
    @PUT("{end}")
    Observable<Res<Object>> dynamicPutRx2(@Path(value="end", encoded = true) String end, @Body LinkedHashMap<String, String> params);
    @DELETE("{end}")
    Observable<Res<Object>> dynamicDeleteRx2(@Path(value="end", encoded = true) String end, @Body LinkedHashMap<String, String> params);

    @POST("/api/other/appSync")
    Call<Res<Map<String, Integer>>> appSync();

    //3.23获取App最新版本,地址格式为/app/v1/{name}/versions/last
    @GET("{name}/versions/last")
    Observable<Res<NewVersionRes>> getAppVersion(@Path("name") String name);
    //3.24 反馈信息,地址格式为/app/v1/{name}/feedback
    @POST("{name}/feedback")
    Observable<Res> feedBack(@Path("name")String name,@Body FeedbackInfoRequest feedbackInfoRequest);
}
